feat!: Use function span op for terminal request handlers - #22871
Open
msonnb wants to merge 7 commits into
Open
Conversation
Middleware spans across the web-server integrations now use the single generic `middleware` op instead of library-specific leaves (`middleware.express`, `middleware.koa`, `middleware.hono`, `middleware.elysia`, `middleware.nestjs`, `middleware.nuxt`, `middleware.nitro`, `middleware.tanstackstart`, and Fastify's `hook.fastify`). The framework is already identified by the span's `sentry.origin` (`auto.http.express`, `auto.middleware.hono`, `auto.middleware.nestjs.guard`, ...), so the library-specific op leaf was redundant. Origins, mechanism types, and the sibling `router.*` / `request_handler.*` / `handler.*` / `function.*` ops are left untouched — those are separate rows in the op cleanup and keep their current values. Fastify's instance hooks map to `middleware`; its handler hook keeps `request_handler.fastify`. Elysia's lifecycle map collapses to `middleware` except `Handle`, which keeps `request_handler.elysia`. nitro and nuxt gain a `@sentry/conventions` dependency (matching the other server packages) so they can import the shared op constant. Part of #22446 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Span creation sites set the op through the `sentry.op` attribute rather than the `op:` shorthand. hono and tanstackstart set both before; koa set only `op:` and now sets only the attribute (matching express, nestjs, nuxt, nitro, and elysia, which were already attribute-only). Unit tests that assert on the start-span call arguments are updated accordingly. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The shared fastify hook wrapper set its op through the `op:` shorthand; it now sets `sentry.op` in attributes instead, matching koa/hono/ tanstackstart. The op is only added when defined so route-hooks (which carry no op) stay unchanged; instance hooks keep `middleware` and the handler hook keeps `request_handler.fastify`. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Migrate the terminal request-handler span ops across the server integrations to the cross-framework `function` op, and trace Hono's internal `app.request()` dispatch as an `http.server` span: - express: `request_handler.express` -> `function` - fastify: `request_handler.fastify` -> `function` - elysia: `request_handler.elysia` -> `function` - nestjs: `handler.nestjs` -> `function` - hono: `hono.request` -> `http.server` Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
size-limit report 📦
|
function span op for terminal request handlersfunction span op for terminal request handlers
msonnb
marked this pull request as ready for review
July 31, 2026 07:35
msonnb
requested review from
isaacs,
mydea,
nicohrubec and
s1gr1d
and removed request for
a team
July 31, 2026 07:35
A plugin-registered hapi route runs the user's request handler, so it is a terminal handler like the express/fastify/hono routes in this migration. Map `plugin.hapi` to the cross-framework `function` op; `router.hapi` and `server.ext.hapi` (framework routing/extension lifecycle) keep their ops. Op is set via the `sentry.op` attribute only; `hapi.type` is unchanged. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Collapses the terminal request-handler span ops across the server frameworks to the cross-framework
functionop, so every "this is where the user's route handler runs" span shares one op regardless of framework.Hono’s app.request() is an internal HTTP dispatch (one sub-app calling another in-process), so it is semantically an inbound server request and is now traced as
http.serverPart of #22446